<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>列固定宽度且居中</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .top,
        .banner,
        .main,
        .footer{
            width: 960px;
            text-align: center;
            margin: 0 auto;
            margin-bottom: 10px;
        }
        .top{
            height: 80px;
            background-color: pink;
        }
        .banner{
            height: 120px;
            background-color: purple;
        }
        .main{
            height: 500px;
            background-color: hotpink;
        }
        .footer{
            height: 150px;
            background-color: black;
            text-align: center;
        }
    </style>
</head>
<body>
    <div class="top">top</div>
    <div class="banner">banner</div>
    <div class="main">main</div>
    <div class="footer">footer</div>
</body>
</html>